<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f"%>
<%@ page import="java.util.List"%>
<%@ page isELIgnored="false" %> <%--isELIgnored=true禁用EL表达式--%>
<!DOCTYPE html>

<html>

	<head>
		<meta charset="UTF-8">


		<title>登录</title>
		<link rel="stylesheet" href="<%=request.getContextPath() %>/css/layui.css" media="all" />
		<link rel="stylesheet" href="<%=request.getContextPath() %>/css/login.css" />
	</head>

	<body class="beg-login-bg" >
		<div class="beg-login-box">
			<header>
				<h1>后台管理系统</h1>
			</header>
			<div class="beg-login-main">
				<form  class="layui-form" method="post">
					<div class="layui-form-item">
						<label class="beg-login-icon">
                        <i class="layui-icon">&#xe612;</i>
                    </label>
						<input type="text"  autocomplete="off" placeholder="这里输入登录名" class="layui-input" id="mName">
					</div>
					<div class="layui-form-item">

						<input type="password"  autocomplete="off" placeholder="这里输入密码" class="layui-input" id="mPass">
					</div>

				</form>
				<div class="layui-form-item">
                    <div class="beg-pull-right">
                        <button class="layui-btn layui-btn-primary" lay-submit lay-filter="login" onclick="login()">登录</button>
                    </div>
                </div>
			</div>
		</div>
		<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.min-2.1.1.js"></script>
        <script>
            function login(){
                var mName = $("#mName").val();
                if(mName == null || mName ==''){
                    alert("用户名不能为空！");
                    return null;
                }
                var mPass = $("#mPass").val();
                if(mPass == null || mPass ==''){
                    alert("密码不能为空！");
                }
                var params="mName="+mName+"&mPass="+mPass;
                $.ajax({
                    url:"login",
                    data:params,
                    type:"post",
                    success:function(str){
                        if(str == "0"){
                            alert("登陆失败");
                        }else{
                            alert("登录成功");
                            window.location.href="indexPage?id="+str;
                        }

                    }



                });
            }
        </script>
	</body>

</html>